package com.xbongbong.parent.interfaces;

import com.xbongbong.paas.field.FieldAttrEntity;
import com.xbongbong.paas.toolbox.exception.XbbException;
import com.xbongbong.pro.formdata.pojo.dto.FormDataDetailDTO;
import com.xbongbong.pro.permission.pojo.dto.VerifyUpdatePermissionDTO;
import com.xbongbong.pro.permission.pojo.dto.VerifyViewPermissionDTO;

import java.util.Map;

/**
 * 权限校验公共方法
 */
public interface ParentPermissionHandle {

    /**
     * 校验用户的数据权限（团队）
     *
     * @param verifyViewPermissionDTO
     * @return
     * @throws XbbException
     */
    boolean checkPermission(VerifyViewPermissionDTO verifyViewPermissionDTO) throws XbbException;

    boolean checkPermission(VerifyUpdatePermissionDTO verifyUpdatePermissionDTO) throws XbbException;

    /**
     * 校验数据查看权限
     *
     * @param verifyViewPermissionDTO
     * @return
     * @throws XbbException
     */
    boolean checkViewPermission(VerifyViewPermissionDTO verifyViewPermissionDTO) throws XbbException;
    /**
     * 校验数据编辑权限
     *
     * @param formDataDetailDTO
     * @param verifyUpdatePermissionDTO
     * @param explainMap
     * @return
     * @throws XbbException
     */
    boolean checkEditPermission(FormDataDetailDTO formDataDetailDTO, VerifyUpdatePermissionDTO verifyUpdatePermissionDTO, Map<String, FieldAttrEntity> explainMap) throws XbbException;

    /**
     * 校验数据编辑权限(不需要团队可编辑)
     *
     * @param verifyUpdatePermissionDTO
     * @return
     * @throws XbbException
     */
    boolean checkEditPermissionWithoutTeamEdit(VerifyUpdatePermissionDTO verifyUpdatePermissionDTO) throws XbbException;

    /**
     * 校验数据编辑权限(不需要共享可编辑)
     *
     * @param formDataDetailDTO
     * @param verifyViewPermissionDTO
     * @param explainMap
     * @return
     * @throws XbbException
     */
    boolean checkEditPermissionWithoutShareEdit(FormDataDetailDTO formDataDetailDTO, VerifyViewPermissionDTO verifyViewPermissionDTO, Map<String, FieldAttrEntity> explainMap) throws XbbException;


}
